package com.example.activemq.quene;


import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.connection.SingleConnectionFactory;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.jms.*;


@Component
public class QueueMessageProducer {

    @Resource(name="activeMQQueue")
    private ActiveMQQueue activeMQQueue;

    @Autowired
    private JmsTemplate jmsTemplate;


    public void sendMessage(String msg) {
        jmsTemplate.convertAndSend(activeMQQueue, msg);
    }


}
